import { createRouter, createWebHashHistory } from 'vue-router'
import LoginView from '../Views/HomeView.vue'
import HomeView from '../Views/LoginView.vue'
import SearchView from '@/Views/SearchView.vue'
import DetailView from '@/Views/DetailView.vue'
import NotFound from '@/Views/NotFound.vue'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home' // 如果访问的是 localhost:5173/#/ => localhost:5173/#/home
        },
        {
            path: '/login',
            component: LoginView
        }, {
            path: "/home",
            component: HomeView
        },
        {
            path:'/search',
            component:SearchView
        },
        {
            path:'/detail/:name/:index',
            component:DetailView
        },{
            path: '/:pathMatch(.*)*',
            component: NotFound
        }
            ] // 对应鸿蒙的router_map.json
}) // 创建路由实例对象

export default router // 到处路由实例对象
